package cn.jiyun.controller;

import cn.jiyun.pojo.Campus;
import cn.jiyun.res.JsonRes;
import cn.jiyun.service.CampusService;
import com.alibaba.dubbo.config.annotation.Reference;
import com.github.pagehelper.PageInfo;
import org.springframework.data.domain.PageImpl;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("campus")
public class CampusController {
    @Reference
    CampusService campusService;
    @RequestMapping("findPage")
    public PageInfo findPage(Integer pageNum, Integer pageSize, @RequestBody Campus campus){
        return campusService.findPage(pageNum,pageSize,campus);
    }
    @RequestMapping("addCampus")
    public JsonRes addCampus(@RequestBody Campus campus){
        return campusService.addCampus(campus);
    }
    @RequestMapping("updateCampus")
    public JsonRes updateCampus(@RequestBody Campus campus){
        return campusService.updateCampus(campus);
    }
    @RequestMapping("delMany")
    public JsonRes delMany(Integer[] ids){
        return campusService.delMany(ids);
    }
    @RequestMapping("findAll")
    public List<Campus> findAll(){
        return campusService.findAll();
    }
}
